package mx.netbrain.dao.impl;

import org.apache.log4j.Logger;
import org.hibernate.Session;

import mx.netbrain.dao.CheckinDao;
import mx.netbrain.model.Checkin;
import mx.netbrain.util.HibernateUtil;

public class CheckinDaoImpl implements CheckinDao {

	private static final Logger logger = Logger.getLogger(CheckinDaoImpl.class);

	@Override
	public void save(Checkin checkin) {
		Session session = HibernateUtil.getSessionFactory().openSession();
		try {
			session.beginTransaction();
			session.persist(checkin);
			session.beginTransaction().commit();
		} catch (Exception e) {
			logger.error("Save: " + e.getMessage());
			session.beginTransaction().rollback();
		}
	}

}
